<?php


namespace app\api\controller;


use app\api\logic\CategoryLogic;
use app\common\controller\BaseApiController;

class CategoryController extends BaseApiController
{
    protected $noNeedLogin = ['*'];

    protected function init()
    {
        parent::init();
        $this->logic = new CategoryLogic();
    }


    public function list()
    {
        $where = [
            ['status', '=', 1]
        ];
//        $this->form['pid'] && $where[] = ['pid', '=', $this->form['pid']];
        return $this->success($this->logic->getList($where, [
            'id',
            'pid',
            'name',
            'icon',
            'level',
        ]));
    }
}